Closed
Conversation
Fixed Tracked Files Fixed Tracked Files
…thn-ruby into enhancment/encoder
Contributor
santiagorodriguez96
left a comment
There was a problem hiding this comment.
Hey @Kaakati! Thank you so much for your contribution! 👋
Sorry for the delayed response. Left a couple of comments 🙂
| # @param data [String] the data to encode | ||
| # @return [String] Base64 encoded data | ||
| def encode_base64(data) | ||
| Base64.strict_encode64(data) |
Contributor
There was a problem hiding this comment.
Comment on lines
+4
to
+17
| module Config | ||
| module Encoder | ||
| # Default encoding type used for WebAuthn operations | ||
| DEFAULT_ENCODING = :base64url | ||
|
|
||
| # Supported encoding types and their corresponding Base64 methods | ||
| ENCODINGS = { | ||
| base64: :strict, | ||
| base64url: :urlsafe | ||
| }.freeze | ||
|
|
||
| # Error message template for unsupported encoding types | ||
| INVALID_ENCODING_ERROR = "Unsupported or unknown encoding: %s".freeze | ||
| end |
Contributor
There was a problem hiding this comment.
Why not just moving these constants inside Webauthn::Encoder?
| # Encode data using URL-safe Base64 encoding without padding | ||
| # @param data [String] the data to encode | ||
| # @return [String] URL-safe Base64 encoded data | ||
| def encode_base64url(data) |
Contributor
There was a problem hiding this comment.
It'd be nice to have these methods public in some way, so that they can be used in our specs to encode/decode data and we can remove the base64 dependency altogether – see this PR.
Comment on lines
+10
to
+13
| ENCODINGS = { | ||
| base64: :strict, | ||
| base64url: :urlsafe | ||
| }.freeze |
Contributor
There was a problem hiding this comment.
We are not using the values of this hash right? Why not just storing the encodings as an array?
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ConfigmoduleBase64module instead of manual string manipulation